class Solution(object):
    def minWindow(self, s1, s2):
        """
        :type s1: str
        :type s2: str
        :rtype: str
        """
        n1 = len(s1)
        n2 = len(s2)
        right_index = 0
        t_count = 0
        min_str = ''
        min_length = float('inf')
        while right_index < n1:
            if s1[right_index] == s2[t_count]:
                t_count += 1
                if t_count == n2:
                    t_count -= 1
                    left_index = right_index
                    while t_count >= 0:
                        if s1[left_index] == s2[t_count]:
                            t_count -= 1
                        left_index -= 1
                    if right_index - left_index < min_length:
                        min_length = right_index - left_index
                        min_str = s1[left_index + 1: right_index + 1]
                    right_index = left_index + 1
            right_index += 1
        return min_str


data = Solution()
s1 = "a"
s2 = "a"
print(data.minWindow(s1, s2))
